#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443

FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["VOL.WebApi/VOL.WebApi.csproj", "VOL.WebApi/"]
COPY ["Orther.BLL/Orther.BLL.csproj", "Orther.BLL/"]
COPY ["Orther.Service/Orther.Service.csproj", "Orther.Service/"]
COPY ["DB.Dapper/DB.Dapper.csproj", "DB.Dapper/"]
COPY ["DB.EF/DB.EF.csproj", "DB.EF/"]
COPY ["VOL.Entity/VOL.Entity.csproj", "VOL.Entity/"]
COPY ["Orther.Model/Orther.Model.csproj", "Orther.Model/"]
COPY ["Project.Utils/Project.Utils.csproj", "Project.Utils/"]
COPY ["VOL.Core/VOL.Core.csproj", "VOL.Core/"]
COPY ["VOL.AppManager/VOL.AppManager.csproj", "VOL.AppManager/"]
COPY ["VOL.System/VOL.System.csproj", "VOL.System/"]
COPY ["VOL.Builder/VOL.Builder.csproj", "VOL.Builder/"]
COPY ["VOL.Miyao/VOL.Miyao.csproj", "VOL.Miyao/"]
COPY ["Vol.Sys/Vol.Sys.csproj", "Vol.Sys/"]
RUN dotnet restore "./VOL.WebApi/VOL.WebApi.csproj"
COPY . .
WORKDIR "/src/VOL.WebApi"
RUN dotnet build "./VOL.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./VOL.WebApi.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "VOL.WebApi.dll"]